package de.jmda.gen.java.impl;

import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.Generator;
import de.jmda.gen.GeneratorException;

public class JUT_DefaultAnnotationStatementGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUT_DefaultAnnotationStatementGenerator.class);

	@Test
	public void testDefaultAnnotationStatementGeneratorString()
			throws GeneratorException
	{
		String input = "@Test";

		Generator generator = new DefaultAnnotationStatementGenerator(input);
		
		StringBuffer generated = generator.generate();

		LOGGER.debug("generated [" + generated + "]");

		assertTrue(
				"unexpected annotation statement [" + generated + "]",
				input.contentEquals(generated));
	}

	@Test(expected=GeneratorException.class)
	public void testInvalidDefaultAnnotationStatementGeneratorString()
			throws GeneratorException
	{
		// missing leading '@'
		String input = "Test";

		Generator generator = new DefaultAnnotationStatementGenerator(input);
		
		generator.generate();
	}
}